package omega

import (
	"time"

	"google.golang.org/grpc"
	"google.golang.org/grpc/keepalive"
)

type Config struct {
	Transport   TransportConfig
	AkkaEnabled bool

	encode Encode
}

func (c *Config) WithLogger(logger *zap.Logger) *Config {
	c.lg = logger
	return c
}

func (c *Config) WithEncode(encode Encode) *Config {
	c.encode = encode
	return c
}

type GrpcClientConfig struct {
	BalancerName string
	Target       string
	Block        bool
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	Credentials  struct {
		Enable     bool
		CertFile   string
		ServerName string
	}
	KeepAlive   *keepalive.ClientParameters
	dialOptions []grpc.DialOption
}

type TransportConfig struct {
	ServiceName         string
	InstanceId          string
	CompCmdChanNum      uint32
	TccCmdChanNum       uint32
	MaxPayloadSize      uint32
	TransportTimeout    time.Duration
	TransportReconDelay time.Duration
	GrcpClient          GrpcClientConfig
}
